package day050626;

import java.util.Arrays;
import java.util.Random;

public class Test9 {
    public static void main(String[] args) throws InterruptedException {
        //创空数组，
        int[]  a={};
        //2.每间隔1秒给数组中放入一个新元素。
        while(true){
            a=Arrays.copyOf(a, a.length+1);//2.1.用copyOf复制a数组，  a.length+1
            Random r=new Random();
            a[a.length-1]=r.nextInt(100);
            System.out.println(Arrays.toString(a));
            Thread.sleep(1000);
        }
    }
}











